package io.github.talelin.latticy.dto.order;

import io.github.talelin.latticy.common.enumeration.CreateTypeEnum;
import io.github.talelin.latticy.common.enumeration.MoneyTypeEnum;
import io.github.talelin.latticy.common.enumeration.OrderTypeEnum;
import io.github.talelin.latticy.common.enumeration.ShipTypeEnum;
import io.github.talelin.latticy.dto.product.SelectProductDTO;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;

/**
 * @authoer:wulongbo
 * @createDate:2022/6/28
 * @description:
 */
@Data
public class CreateOrderDTO {

    @Pattern(regexp = "^[0-9a-zA-Z_]{1,}$", message = "{warehouse.code.pattern}")
    @Length(min = 3, max = 8, message = "{warehouse.code.length}")
    @NotBlank
    private String code;

    /**
     * 物流方式/承运商
     */
    private String logistics;

    /**
     * 跟踪号
     */
    private String trackingNo;

    /**
     * 参考号
     */
    private String referenceNo;

    /**
     * 订单备注
     */
    private String remake;

    /**
     * 收件人
     */
    @NotBlank
    private String receiver;

    /**
     * 电子邮件
     */
    @Email(message = "{email}")
    private String email;

    /**
     * 国家编码
     */
    private Integer countryCode;

    /**
     * 省/州编码
     */
    private Integer cityCode;

    /**
     * 城市/区编码
     */
    private Integer areaCode;

    /**
     * 公司名称
     */
    private String companyName;


    /**
     * 联系电话
     */
    private String phone;

    /**
     * 邮编
     */
    private String postCode;

    /**
     * 收件地区
     */
    @NotBlank
    private String address;

    /**
     * 收件地区2
     */
    private String addressAnother;

    /**
     * 详细地址/门牌号
     */
    @NotBlank
    private String detail;

    private CreateTypeEnum createType;

    private OrderTypeEnum orderType;

    private ShipTypeEnum shipType;

    /**
     * 订单总价
     */
    @Digits(integer = 10, fraction = 2)
    private BigDecimal totalPrice;

    /**
     * 币种
     */
    private MoneyTypeEnum moneyType;

    /**
     * 店铺名称
     */
    private String shopName;

    /**
     * 店铺code
     */
    private String shopCode;

    /**
     * 操作类型
     */
    private Integer operationType;

    /**
     * 平台类型
     */
    private String platformType;


    @Valid
    private List<SelectProductDTO> products;
}
